<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Calico: python.utils Namespace Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Calico
   </div>
   <div id="projectbrief">A visual-inertial calibration library designed for rapid problem construction and debugging.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><b>python</b></li><li class="navelem"><a class="el" href="namespacepython_1_1utils.html">utils</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">python.utils Namespace Reference</div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:aa9b2525642c6f52cb123793e081d8fbc"><td class="memItemLeft" align="right" valign="top">Tuple[np.ndarray, np.ndarray, np.ndarray]&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacepython_1_1utils.html#aa9b2525642c6f52cb123793e081d8fbc">ComputeRmseHeatmapAndFeatureCount</a> (List[Tuple[calico.CameraMeasurement, np.ndarray]] measurement_residual_pairs, int image_width, int image_height, int num_rows=8, int num_cols=12)</td></tr>
<tr class="separator:aa9b2525642c6f52cb123793e081d8fbc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a00b6c3490b3740af5750d9b04e2f49e3"><td class="memItemLeft" align="right" valign="top">np.ndarray&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacepython_1_1utils.html#a00b6c3490b3740af5750d9b04e2f49e3">DrawDetections</a> (np.ndarray img, Dict[int, np.ndarray] detections)</td></tr>
<tr class="separator:a00b6c3490b3740af5750d9b04e2f49e3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a95bbea75973db244f9b74de9767aa039"><td class="memItemLeft" align="right" valign="top">List[calico.CameraMeasurement]&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacepython_1_1utils.html#a95bbea75973db244f9b74de9767aa039">DetectionsToCameraMeasurements</a> (Dict[int, np.ndarray] detections, float stamp, int seq)</td></tr>
<tr class="separator:a95bbea75973db244f9b74de9767aa039"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a44ec1e8887c4150fb7373a6c21aadd6a"><td class="memItemLeft" align="right" valign="top">Tuple[np.ndarray, List[np.ndarray], List[np.ndarray]]&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacepython_1_1utils.html#a44ec1e8887c4150fb7373a6c21aadd6a">InitializePinholeAndPoses</a> (List[Dict[int, np.ndarray]] all_detections, Dict[int, np.ndarray] model_definition)</td></tr>
<tr class="separator:a44ec1e8887c4150fb7373a6c21aadd6a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><pre class="fragment">@package Python utils
Utility functions for calico python bindings.
</pre> </div><h2 class="groupheader">Function Documentation</h2>
<a id="aa9b2525642c6f52cb123793e081d8fbc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa9b2525642c6f52cb123793e081d8fbc">&#9670;&nbsp;</a></span>ComputeRmseHeatmapAndFeatureCount()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"> Tuple[np.ndarray, np.ndarray, np.ndarray] python.utils.ComputeRmseHeatmapAndFeatureCount </td>
          <td>(</td>
          <td class="paramtype">List[Tuple[calico.CameraMeasurement, np.ndarray]]&#160;</td>
          <td class="paramname"><em>measurement_residual_pairs</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>image_width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>image_height</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int &#160;</td>
          <td class="paramname"><em>num_rows</em> = <code>8</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int &#160;</td>
          <td class="paramname"><em>num_cols</em> = <code>12</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<pre class="fragment"> Compute the RMSE heatmap with specified resolution.

Args:
  measurement_residual_pairs:
    List of camera measurements paired with their residuals.
  image_width:
    Width of the original image.
  image_height:
    Height of the original image.
  num_rows:
    Number of rows we want to divide the image into.
  num_cols:
    Number of columns we want to divide the image into.

Returns:
  A tuple containing:
    1. An rmse heatmap image with dimensions image_width x image_height.
    2. A binned version of the RMSE heatmap as a num_rows x num_cols array.
    3. A num_rows x num_cols array representing the number of features detected
       in a particular region of the image space.
</pre> 
</div>
</div>
<a id="a95bbea75973db244f9b74de9767aa039"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a95bbea75973db244f9b74de9767aa039">&#9670;&nbsp;</a></span>DetectionsToCameraMeasurements()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"> List[calico.CameraMeasurement] python.utils.DetectionsToCameraMeasurements </td>
          <td>(</td>
          <td class="paramtype">Dict[int, np.ndarray]&#160;</td>
          <td class="paramname"><em>detections</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>stamp</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>seq</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<pre class="fragment">Convenience function for converting a calibration chart detection into
camera measurement types.
</pre> 
</div>
</div>
<a id="a00b6c3490b3740af5750d9b04e2f49e3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a00b6c3490b3740af5750d9b04e2f49e3">&#9670;&nbsp;</a></span>DrawDetections()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"> np.ndarray python.utils.DrawDetections </td>
          <td>(</td>
          <td class="paramtype">np.ndarray&#160;</td>
          <td class="paramname"><em>img</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Dict[int, np.ndarray]
&#160;</td>
          <td class="paramname"><em>detections</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<pre class="fragment">Small helper function for drawing detections onto the original image.

Args:
  img: Original grayscale image.
  detections: Dictionary mapping feature id to its pixel location.

Returns:
  Color image with detections drawn.
</pre> 
</div>
</div>
<a id="a44ec1e8887c4150fb7373a6c21aadd6a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a44ec1e8887c4150fb7373a6c21aadd6a">&#9670;&nbsp;</a></span>InitializePinholeAndPoses()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"> Tuple[np.ndarray, List[np.ndarray], List[np.ndarray]] python.utils.InitializePinholeAndPoses </td>
          <td>(</td>
          <td class="paramtype">List[Dict[int, np.ndarray]]&#160;</td>
          <td class="paramname"><em>all_detections</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Dict[int, np.ndarray]
&#160;</td>
          <td class="paramname"><em>model_definition</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<pre class="fragment">Implements Zhang's pinhole estimation algorithm.
https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/tr98-71.pdf
For convenience, we also return the pose of the camera w.r.t. the calibration
chart.

Args:
  measurements:
    List of calibration chart detections where each list element represents
    detections for one image frame.
  model_definition:
    Dictionary mapping feature ID of a calibration chart to its metric
    coordinate resolved in the chart's frame.

Returns:
  intrinsics:
    Pinhole parameters as a 5-vector in the order [fx, fy, s, cx, cy] such that
    K = [fx  s cx]
        [ 0 fy cy]
        [ 0  0  1]
  R_chart_camera:
    List of 3x3 
</pre> 
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>
